<!DOCTYPE html>
<html>
  <head>
    <title><%= title %></title>
    <link rel='stylesheet' href='/stylesheets/style.css' />
  </head>
  <body>
    <h1><%= title %></h1>
    <p>Welcome to <%= title %></p>
  </body>
</html>

<script>
  window.onload = (() => {
    var ws = new WebSocket("ws://127.0.0.1:4000/mySocketUrl");
    ws.onopen = function(){
      //当WebSocket创建成功时，触发onopen事件
      console.log("open");
      ws.send("hello"); //将消息发送到服务端
    }
  })
</script>